import re


def check(password):
    return (len(password) >= 6) & (len(password) <= 12) & (re.search(r"[a-z]+", password) is not None) & (
                re.search(r"[0-9]+", password) is not None) & (re.search(r"[A-Z]+", password) is not None) & (
                       re.search(r"[$#@]+", password) is not None)


def solve():
    passwords = input().split(',')
    for password in passwords:
        if check(password):
            print(password)


if __name__ == "__main__":
    solve()
